#include "Penguin.h"
#include "Physics.h"

#include "Body.h"


Penguin::Penguin(void) : GameObject()
{
	vx = 1;
}


Penguin::~Penguin(void)
{
}

void Penguin::update()
{
	GameObject::update();
	Physics* vatly = (Physics*)getComponentById(PHYSICS);	
	Body* bd = (Body*)getComponentById(BODY1);	
	if(vatly->getPosition().x >= 1900)
	{
		bd->setSprite(GO_LEFT);
		vatly->setV(-vx,0);
	}
	if (vatly->getPosition().x < 10)//go left
	{
		bd->setSprite(GO_RIGHT);
		vatly->setV(vx,0);
	}
}

D3DXVECTOR2 Penguin::getPosition()
{
	Physics* vatly = (Physics*)getComponentById(PHYSICS);
	return vatly->getPosition();
}

